GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 59d732...3562ec )
by James
28:30 queued 12:37
created

list.js ➔ goToBulkEdit   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 15
rs 9.4285
c 1
b 0
f 0
cc 2
nc 2
nop 0
1
/*
2
 * list.js
3
 * Copyright (c) 2017 [email protected]
4
 *
5
 * This file is part of Firefly III.
6
 *
7
 * Firefly III is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * Firefly III is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
/** global: edit_selected_txt, edit_bulk_selected_txt, delete_selected_txt, token */
22
23
/**
24
 *
25
 */
26
$(document).ready(function () {
27
    "use strict";
28
    $('.mass_edit_all').show();
29
    $('.mass_select').click(startMassSelect);
30
    $('.mass_stop_select').click(stopMassSelect);
31
32
    // top button to select all / deselect all:
33
    $('input[name="select_all"]').change(function () {
34
        if (this.checked) {
35
            checkAll();
36
            countChecked();
37
        } else {
38
            uncheckAll();
39
            countChecked();
40
        }
41
    });
42
    $('.select_all_single').unbind('change').change(function () {
43
        countChecked();
44
    });
45
46
    // click the mass edit button:
47
    $('.mass_edit').click(goToMassEdit);
48
    // click the bulk edit button:
49
    $('.bulk_edit').click(goToBulkEdit);
50
    // click the delete button:
51
    $('.mass_delete').click(goToMassDelete);
52
});
53
54
/**
55
 *
56
 * @returns {boolean}
57
 */
58
function goToMassEdit() {
59
    "use strict";
60
    var checkedArray = getCheckboxes();
61
62
    // go to specially crafted URL:
63
    var bases = document.getElementsByTagName('base');
64
    var baseHref = null;
65
66
    if (bases.length > 0) {
67
        baseHref = bases[0].href;
68
    }
69
70
    window.location.href = baseHref + '/transactions/mass/edit/' + checkedArray;
71
    return false;
72
}
73
74
/**
75
 *
76
 * @returns {boolean}
77
 */
78
function goToBulkEdit() {
79
    "use strict";
80
    var checkedArray = getCheckboxes();
81
82
    // go to specially crafted URL:
83
    var bases = document.getElementsByTagName('base');
84
    var baseHref = null;
85
86
    if (bases.length > 0) {
87
        baseHref = bases[0].href;
88
    }
89
90
    window.location.href = baseHref + '/transactions/bulk/edit/' + checkedArray;
91
    return false;
92
}
93
94
/**
95
 *
96
 * @returns {boolean}
97
 */
98
function goToMassDelete() {
99
    "use strict";
100
    var checkedArray = getCheckboxes();
101
102
    // go to specially crafted URL:
103
    var bases = document.getElementsByTagName('base');
104
    var baseHref = null;
105
106
    if (bases.length > 0) {
107
        baseHref = bases[0].href;
108
    }
109
    window.location.href = baseHref + '/transactions/mass/delete/' + checkedArray;
110
    return false;
111
}
112
113
/**
114
 *
115
 * @returns {Array}
116
 */
117
function getCheckboxes() {
118
    "use strict";
119
    var list = [];
120
    $.each($('.select_all_single'), function (i, v) {
121
        var checkbox = $(v);
122
        if (checkbox.prop('checked')) {
123
            // add to list.
124
            list.push(checkbox.val());
125
        }
126
    });
127
    return list;
128
}
129
130
/**
131
 *
132
 */
133
function countChecked() {
134
    "use strict";
135
    var checked = $('.select_all_single:checked').length;
136
    if (checked > 0) {
137
        $('.mass_edit span').text(edit_selected_txt + ' (' + checked + ')');
138
        $('.bulk_edit span').text(edit_bulk_selected_txt + ' (' + checked + ')');
139
        $('.mass_delete span').text(delete_selected_txt + ' (' + checked + ')');
140
141
        // get amount for the transactions:
142
        //getAmounts();
143
144
        $('.mass_button_options').show();
145
146
    } else {
147
        $('.mass_button_options').hide();
148
    }
149
}
150
151
/**
152
 *
153
 */
154
function checkAll() {
155
    "use strict";
156
    $('.select_all_single').prop('checked', true);
157
}
158
159
/**
160
 *
161
 */
162
function uncheckAll() {
163
    "use strict";
164
    $('.select_all_single').prop('checked', false);
165
}
166
167
/**
168
 *
169
 * @returns {boolean}
170
 */
171
function stopMassSelect() {
172
    "use strict";
173
174
    // uncheck all:
175
    $('input[name="select_all"]').prop('checked', false);
176
    uncheckAll();
177
    countChecked();
178
179
180
    // hide "select all" box in table header.
181
    $('.select_boxes').hide();
182
183
    // show the other header cell.
184
    $('.no_select_boxes').show();
185
186
    // show edit/delete buttons
187
    $('.edit_buttons').show();
188
189
    // hide the checkbox.
190
    $('.select_single').hide();
191
192
    // show the start button
193
    $('.mass_select').show();
194
195
    // hide the stop button
196
    $('.mass_stop_select').hide();
197
198
    // show reconcile account button, if present
199
    $('.mass_reconcile').show();
200
201
    return false;
202
}
203
204
/**
205
 *
206
 * @returns {boolean}
207
 */
208
function startMassSelect() {
209
    "use strict";
210
    // show "select all" box in table header.
211
    $('.select_boxes').show();
212
213
    // hide the other header cell.
214
    $('.no_select_boxes').hide();
215
216
    // hide edit/delete buttons
217
    $('.edit_buttons').hide();
218
219
    // show the checkbox.
220
    $('.select_single').show();
221
222
    // hide the start button
223
    $('.mass_select').hide();
224
225
    // show the stop button
226
    $('.mass_stop_select').show();
227
228
    // hide reconcile account button, if present
229
    $('.mass_reconcile').hide();
230
231
    return false;
232
}